1. Field of the Invention
The present invention relates to an image encoding method and apparatus, used when image information is stored in storage means and, more specifically, an image encoding method and apparatus, which are suitably used in an image output apparatus such as a printer, an apparatus having means for compressing input image data and storing compressed image data, or the like.
2. Description of the Related Art
In recent years, with the advent of high-resolution, full-color image display units, and along with remarkable development of the semiconductor techniques, it is technically possible to provide an apparatus which can store high-resolution full-color information in a memory, and can output it to an image display unit.
However, in order to store a large amount of image data, a very large memory capacity is required, and such a large-capacity memory leads to an increase in cost of the apparatus. For example, an A3-size full-color image which has a resolution of 400 dots per inch (to be abbreviated as dpi hereinafter), and in which each of red, blue, and green color data is expressed by 8 bits, requires an information amount of about 96 Mbytes, and 192 4-Mbit memories are required to store the A3-size full color image.
Thus, a technique for storing a full-color image in a small-capacity memory by decreasing the amount of image data using an image compression method has been conventionally adopted.
As one of international standard color still image encoding methods, an encoding method of a baseline system proposed by the JPEG (Joint Photographic Experts Group) is known. Although it will not be described in detail herein, with this method, a DCT-transformed quantization coefficient is variable-length encoded by Huffman encoding. Since this method adopts variable-length encoding, it is difficult to control a certain type of objective image to fall within a predetermined memory area.
As proposed in U.S.Patent application Ser. No. 738,562 (filed on Jul. 31, 1991), in a method of fixed-length encoding a DCT-transformed quantization coefficient in units of blocks, image quality deteriorates in some blocks due to unbalanced amount of image data in each block of an image.
Thus, in order to apply the above-mentioned JPEG method to a so-called electronic image pickup camera for electronically picking up an image, and storing the picked-up image in a floppy disk or an IC card, a code amount (an amount of code) control method has been proposed in U.S. patent application Ser. No. 753,660 (filed on Aug. 30, 1991).
However, image data normally suffers from considerable unbalance of information.
For example, an area of a blue sky without a speck of cloud can almost be expressed by DC components alone, while an area of crowded twigs requires many high frequency components in addition to DC components to express the crowded twigs.
For this reason, the code amount (the number of bits) necessary for preserving image information varies largely depending on blocks, and a difference between such blocks becomes ten times or more.
However, when an identical code amount is assigned to the blocks, as described above, a block with a small information amount cannot efficiently use the memory, and a memory capacity several times that which is efficiently used in practice must be prepared.
Furthermore, when the above-mentioned electronic image pickup camera system is applied to a printer having a certain memory capacity, input image sizes may often vary, and since the printer has no frame memory, it is difficult to determine encoding parameters by several trials (if information is transmitted from a connected host computer several times, the transfer time is undesirably prolonged).
Furthermore, the following drawbacks are posed.
(1) When image data for one page is constituted by a plurality of partial images, as shown in FIG. 41, and these partial images have different characteristics respectively, they must use different optimal compression parameters respectively, resulting in a decrease in compression efficiency.
(2) Since a blank portion other than an image is also determined as image data, the code amount is increased, resulting in an increase in redundancy.
(3) When compression is performed by a variable-length encoding method, the code amount in a page is fixed. Thus, if compression is performed by a 1-pass method, portions at the beginning and end of the page have different image quality levels, and image quality as a whole deteriorates.
(4) When image data for one page is constituted by a plurality of partial images, required image quality cannot be set for each of the partial images. In addition, compression parameters cannot be controlled according to attributes of the partial images.
It is an object of the present invention to eliminate the drawbacks of the above-mentioned techniques.
More specifically, it is an object of the present invention to satisfactorily control the amount of encoded image data.
In order to achieve the above object, according to the present invention, there is disclosed an image encoding apparatus comprising:
an inputter for inputting data representing an image constituted by a plurality of block images, and for sequentially supplying image data representing individual ones of the plurality of block images, on a block by block basis;
an image data transformer, arranged for transforming image data representing an individual block image, supplied by the inputter, into corresponding spatial frequency component data;
an encoder, arranged for quantizing the spatial frequency component data supplied by the image data transformer, to provide quantized spatial frequency component data, and for encoding the quantized spatial frequency component data;
a comparer, arranged for comparing an amount of encoded spatial frequency component data provided by the encoder with a predetermined lower value and a predetermined higher value, before the encoder encodes next spatial frequency component data; and
a quantization parameter setter, arranged for setting a quantization parameter to be utilized by the encoder for quantizing the next spatial frequency component data, based on a comparison result of the comparer so that the amount of the encoded data falls within a predetermined range.
It is another object of the present invention to perform proper image encoding in accordance with the size of an original.
It is still another object of the present invention to improve a variable-length encoding method.
Other objects and aspects of the present invention will become apparent from the following description taken in conjunction with the accompanying drawings, and the description of appended claims.